Skip to content

feat(content): clarify page and collection creation - #5592

Merged
3mdistal merged 37 commits into
mainfrom
t3code/content-page-collection-choice
Sep 23, 2026
Merged

3mdistal merged 37 commits into
mainfrom
t3code/content-page-collection-choice

Conversation

@3mdistal

@3mdistal 3mdistal commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Content’s plus button used to create a page immediately, even when the user wanted a collection. The editor’s earlier type chooser also disappeared after a title was entered. This PR makes the object type an explicit choice while keeping page writing fast.

  • The top-level plus opens Page and Collection in both expanded and collapsed sidebar states. Escape closes the menu without creating anything.
  • Creating a Page or Collection from a different workspace row waits for workspace selection before creation and holds that choice explicit until the new route opens; the same sequencing covers child creation.
  • The workspace-name dropdown switches spaces and offers New workspace and Local folder. Opening the new-workspace dialog waits for the menu to close so the name field receives focus.
  • An empty page keeps a Create collection starter after title edits. The starter waits until collaborative editing is ready; conversion saves the current title and body and preserves the latest stored description.
  • /database offers inline and full-page collections. Full-page insertion replaces its containing paragraph as a block, matching /page, and uses a stable document ID/idempotency key so a lost response can be retried without a duplicate. Inline collection and slash Page creation allocate document IDs before calling their actions, allowing cleanup even when a creation response is lost; inline creation also supplies its block ID. All slash Page/Collection creation paths remove a newly inserted reference and use a creator-scoped rollback action if saving the parent fails; the action refuses to trash a linked or changed resource and distinguishes an absent resource from one it moved to Trash. Both collection paths use collection-neutral success feedback in every locale.

No schema changes are involved. During final CI, a security guard found an unscoped cache update in Slides inherited from main; the update now requires editor access in its SQL predicate. Viewer reads still return the design system, but no longer write that cache field.

Validation

  • Focused editor, sidebar, database, rollback, and hook tests: 185/185 passed. A database-backed test verified caller-supplied inline IDs, creator-scoped rollback, and absent-resource reporting (27/27 in that file); focused slash Page creation tests passed 41/41 after the final repair. Content typecheck passed. Parity matrix and rollback tests passed 7/7. Slides' focused design-system tests (3) and typecheck passed after the main merge. Local production-credential diagnostics are expected in this dev environment.
  • CI passed on the merged-with-main head, including all five targeted fast-test lanes and required checks.
  • Human QA on earlier heads covered expanded and collapsed creation menus, Escape, root Page and Collection creation, workspace/source menu, workspace dialog, and titled empty Page conversion. On this head, a new Page received an inline /database collection; its table persisted after reload. A separate /page command created a child Page and retained the parent reference after reload. The browser reported no errors. On the preceding head, the full-page /database flow created one collection, opened its table, and retained the parent reference after reload with no browser console or network errors. Disposable QA pages and their children were moved to Trash. The lost-response cleanup paths are covered by focused database and hook tests; a real network response-loss simulation has not been run.
content_product_impact:
  lane: contract_repair
  features:
    - content.feature.durable-foundations
  capabilities:
    - content.object.page
    - content.object.database
    - content.agent.action-parity
  record_change: none
  proof:
    - corepack pnpm --filter content exec vitest --run app/components/sidebar/DocumentSidebar.layout.test.ts app/components/editor/SlashCommandMenu.test.ts
    - human QA through Content's creation and conversion flows
  rationale: The change repairs object creation choice and conversion without changing the accepted Page or Database contracts.

3mdistal and others added 16 commits August 21, 2026 00:41
- Exclude legacy authorityScope from the mutation payload digest so retries through old callers replay instead of colliding on IDEMPOTENCY_KEY_REUSED.
- Reject empty propertyEntries arrays instead of silently canonicalizing them to a no-op mutation.
- Check durable replay before typed property assertion validation so a retried committed mutation replays even if the property's type later changed.
- Register list-content-databases and get-content-database fixtures in the dedicated property-preservation runner so discovery can succeed before the create call.
…rvation create call

expected_property_values now requires list-content-databases and get-content-database to complete without error and validates their result payloads (discovered database and mutation contract target/schema revision) match the fixture create target, instead of only checking call order and input shape.
…ollection-choice

# Conflicts:
#	templates/content/actions/_database-row-mutation.ts
#	templates/content/actions/add-database-item.ts
#	templates/content/actions/update-database-item.ts
#	templates/content/actions/upsert-database-item-by-key.ts
#	templates/content/app/components/editor/DocumentEditor.layout.test.ts
#	templates/content/app/components/editor/DocumentEditor.tsx
#	templates/content/app/components/sidebar/DocumentSidebar.layout.test.ts
#	templates/content/app/components/sidebar/DocumentSidebar.tsx
#	templates/content/app/i18n-data.ts
#	templates/content/app/i18n/zh-TW.ts
#	templates/content/docs/solutions/2026-09-02-content-suggested-edits-parity-shape.md
builder-io-integration[bot]

This comment was marked as outdated.

@github-actions
github-actions Bot temporarily deployed to pr-5592-mail September 22, 2026 03:37 Destroyed
@github-actions
github-actions Bot temporarily deployed to pr-5592-content September 22, 2026 03:37 Destroyed
@github-actions

github-actions Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Here's a visual recap of what changed:

Visual recap

Open the full interactive recap

builder-io-integration[bot]

This comment was marked as outdated.

@github-actions
github-actions Bot temporarily deployed to pr-5592-mail September 22, 2026 18:05 Destroyed
@github-actions
github-actions Bot temporarily deployed to pr-5592-content September 22, 2026 18:05 Destroyed
builder-io-integration[bot]

This comment was marked as outdated.

builder-io-integration[bot]

This comment was marked as outdated.

builder-io-integration[bot]

This comment was marked as outdated.

@github-actions
github-actions Bot temporarily deployed to pr-5592-slides September 23, 2026 17:25 Destroyed
@github-actions
github-actions Bot temporarily deployed to pr-5592-content September 23, 2026 17:25 Destroyed
builder-io-integration[bot]

This comment was marked as outdated.

@builder-io-integration builder-io-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Builder reviewed your changes and found 1 potential issue 🟡

Review Details

Code Review Summary

This incremental review covers the latest 25-file update to PR #5592, which refines Content Page/Collection creation, adds inline and full-page slash-command flows with compensating cleanup, sequences workspace selection before creation, and scopes the Slides design-system cache update with an editor access filter. The core UI and state-management approach is sound, and the previously reported inline slash-input-loss and stale explicit-workspace-selection issues are fixed in this head; both existing threads were resolved rather than reposted. Focused tests passed: 180 Content tests across the affected editor/sidebar suites and 3 Slides design-system tests. The test process also emitted expected local connection errors while probing unavailable services, but the suites completed successfully.

Key Findings

🟡 MEDIUM

  • Slash-command rollback invokes admin-only deletion actions even though the corresponding creation actions allow an editor of the host page. A non-admin collaborator can therefore create an inline or full-page collection, fail while persisting the parent, and leave the newly-created collection behind because client cleanup is rejected.

Architecture and validation

The new create-then-persist flow correctly avoids deleting inline slash text before creation succeeds, and cleanup attempts reference removal independently from resource deletion. Workspace selection now restores the prior explicit-selection state when selection fails, and the Slides update predicate is appropriately constrained by accessFilter(..., "editor"). The remaining authorization mismatch should be addressed with a narrowly scoped rollback operation or server-owned transactional compensation rather than the normal admin-only trash actions.

🧪 Browser testing: Planned full visual verification, but all 19 cases were blocked because browser executor agents had no Chrome/MCP tools exposed. The dev server was healthy with Content mounted at /content; no browser success or failure was claimed.

Comment thread templates/content/app/components/editor/SlashCommandMenu.tsx Outdated
@github-actions
github-actions Bot temporarily deployed to pr-5592-content September 23, 2026 18:22 Destroyed

@builder-io-integration builder-io-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Builder reviewed your changes and found 1 potential issue 🟡

Review Details

Code Review Summary

This incremental review covers the current PR head and the Content creation flows, slash-command persistence, workspace sequencing, and Slides access-scoped cache update. The previously reported admin-only cleanup mismatch remains present and was intentionally not reposted because its review thread is still open. The latest code continues to use the corrected editor/workspace behavior, and focused validation passed: 180 Content tests across the affected editor/sidebar suites and 3 Slides design-system tests.

Key Findings

🟡 MEDIUM

  • Full-page /database slash creation does not provide the stable document/idempotency identifiers used by the sidebar creation path. A committed request whose response is lost cannot be replayed or reconciled, and a retry can create a duplicate child collection; because the cleanup state is assigned only after the response, the original resource can also become orphaned.

Architecture and validation

The existing create-then-insert ordering is sound for preserving editor input on early failures, and workspace selection recovery remains correct. The Slides accessFilter(..., "editor") update remains appropriately scoped. The full-page slash path should be routed through the existing reliable creation request shape or generate and pass a stable newDocumentId/idempotencyKey before invoking the mutation.

🧪 Browser testing: Planned full visual verification across 18 cases, but all cases were blocked because Chrome/MCP tools were unavailable to browser executor agents. The dev server was healthy with Content mounted at /content; no browser success or failure was claimed.

Comment thread templates/content/app/components/editor/SlashCommandMenu.tsx Outdated
@github-actions
github-actions Bot temporarily deployed to pr-5592-content September 23, 2026 18:40 Destroyed
@github-actions
github-actions Bot temporarily deployed to pr-5592-slides September 23, 2026 18:40 Destroyed

@builder-io-integration builder-io-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Builder reviewed your changes and found 3 potential issues 🟡

Review Details

Code Review Summary

This incremental review covers the new creator-scoped rollback action and its wiring into Page, inline Collection, and full-page Collection slash commands, alongside the existing workspace-selection and Slides access-control changes. The two previously reported comments remain open and were not reposted: the full-page idempotency-key concern and the earlier cleanup authorization concern. The new rollback action improves authorization and eligibility checks, and focused validation passed: 74 Content tests across rollback, slash-command, and sidebar suites, plus 3 Slides design-system tests.

Key Findings

🟡 MEDIUM

  • Inline and full-page slash creation can commit the child resource before the mutation returns its result; if post-commit response/readback or refresh work fails, the client never receives the ID needed to invoke rollback, leaving an unlinked collection behind.
  • Cross-workspace creation switches with navigation suppressed but does not mark the target as an explicit selection. Route reconciliation can therefore switch the sidebar back to the active document's old workspace before creation completes.

Architecture and validation

The creator-scoped rollback action is a good improvement: it requires parent editor access, verifies creator identity, freshness, unchanged content, and absence of links/children before trashing transactionally. However, the client still needs a recoverable creation contract for post-commit failures, and the workspace selection needs to participate in the existing explicit-selection reconciliation guard. Focused tests passed, while full browser verification was blocked by unavailable Chrome/MCP executor tools despite a healthy dev server.

🧪 Browser testing: Planned full visual verification across 20 cases, but all cases were blocked because Chrome/MCP tools were unavailable to browser executor agents. No live UI success or failure was claimed.

Comment thread templates/content/app/components/editor/SlashCommandMenu.tsx
Comment thread templates/content/app/components/editor/SlashCommandMenu.tsx
Comment thread templates/content/app/components/sidebar/DocumentSidebar.tsx Outdated
@3mdistal
3mdistal merged commit a16b71d into main Sep 23, 2026
48 of 50 checks passed
@3mdistal
3mdistal deleted the t3code/content-page-collection-choice branch September 23, 2026 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants